home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / ip / ka9q / osrc.arc / AX25.H < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-26  |  3.4 KB  |  104 lines

  1. #ifndef    NULLAXADDR
  2.  
  3. #include "global.h"
  4.  
  5. /* AX.25 datagram (address) sub-layer definitions */
  6.  
  7. #define    NAXROUTE    5    /* Number of hash chains in routing table */
  8. #define    MAXDIGIS    7    /* Maximum number of digipeaters */
  9. #define    ALEN        6    /* Number of chars in callsign field */
  10. #define    AXALEN        7    /* Total AX.25 address length, including SSID */
  11.  
  12. /* Internal representation of an AX.25 address */
  13. struct ax25_addr {
  14.     char call[ALEN];    
  15.     char ssid;
  16. #define    SSID        0x1e    /* Sub station ID */
  17. #define    REPEATED    0x80    /* Has-been-repeated bit in repeater field */
  18. #define    E        0x01    /* Address extension bit */
  19. #define    C        0x80    /* Command/response designation */
  20. };
  21. #define    NULLAXADDR    (struct ax25_addr *)0
  22. /* Our AX.25 address */
  23. extern struct ax25_addr Mycall;
  24.  
  25. /* AX.25 broadcast address: "QST   -0" in shifted ASCII */
  26. extern struct ax25_addr Ax25_bdcst;
  27.  
  28. /* Internal representation of an AX.25 header */
  29. struct ax25 {
  30.     struct ax25_addr dest;            /* Destination address */
  31.     struct ax25_addr source;        /* Source address */
  32.     struct ax25_addr digis[MAXDIGIS];    /* Digi string */
  33.     int ndigis;                /* Number of digipeaters */
  34.     int cmdrsp;                /* Command/response */
  35. };
  36.  
  37. /* C-bit stuff */
  38. #define    UNKNOWN        0
  39. #define    COMMAND        1
  40. #define    RESPONSE    2
  41.  
  42. /* AX.25 routing table entry */
  43. struct ax_route {
  44.     struct ax_route *prev;        /* Linked list pointers */
  45.     struct ax_route *next;
  46.     struct ax25_addr target;
  47.     struct ax25_addr digis[MAXDIGIS];
  48.     int ndigis;
  49.     char type;
  50. #define    AX_LOCAL    1        /* Set by local ax25 route command */
  51. #define    AX_AUTO        2        /* Set by incoming packet */
  52. };
  53. #define NULLAXR    ((struct ax_route *)0)
  54. extern struct ax_route *Ax_routes[NAXROUTE];
  55.  
  56. /* AX.25 Level 3 Protocol IDs (PIDs) */
  57. #define    PID_SEGMENT    0x08    /* Segmentation fragment */
  58. #define    PID_IP        0xcc    /* ARPA Internet Protocol */
  59. #define    PID_ARP        0xcd    /* ARPA Address Resolution Protocol */
  60. #define    PID_NETROM    0xcf    /* NET/ROM */
  61. #define    PID_NO_L3    0xf0    /* No level 3 protocol */
  62.  
  63. #define    SEG_FIRST    0x80    /* First segment of a sequence */
  64. #define    SEG_REM        0x7f    /* Mask for # segments remaining */
  65.  
  66. #if    defined(__STDC__) || defined(__TURBOC__)
  67.  
  68. struct ax25_cb *open_ax25(struct iface *,struct ax25_addr *,struct ax25_addr *,
  69.     int16,void (*)(),void (*)(),void (*)(),int user);
  70. int send_ax25(struct ax25_cb *axp,struct mbuf *bp,int pid);
  71. struct mbuf *recv_ax25(struct ax25_cb *axp,int16 cnt);
  72. int ax25val(struct ax25_cb *axp);
  73. int kick_ax25(struct ax25_cb *axp);
  74. int reset_ax25(struct ax25_cb *axp);
  75. struct ax25_cb *find_ax25(struct ax25_addr *);
  76. int ax_send(struct mbuf *bp,struct iface *iface,int32 gateway,int prec,
  77.     int del,int tput,int rel);
  78. int ax_output(struct iface *iface,char *dest,char *source,int16 pid,
  79.     struct mbuf *data);
  80. struct ax_route *ax_lookup(struct ax25_addr *);
  81. struct ax_route *ax_add(struct ax25_addr *,int,struct ax25_addr *,int);
  82. int ax_drop(struct ax25_addr *);
  83. int sendframe(struct ax25_cb *axp,int cmdrsp,int ctl,struct mbuf *data);
  84. void axarp(void);
  85. struct mbuf *segmenter(struct mbuf *bp,int16 ssize);
  86. void s_arcall(),s_atcall(),s_ascall();
  87. void st_ax25();
  88. int ax_recv(struct iface *,struct mbuf *);
  89. #else
  90. struct mbuf *recv_ax25();
  91. struct ax25_cb *open_ax25(),*find_ax25();
  92. int ax_send(),ax_output();
  93. struct ax_route *ax_lookup(),*ax_add();
  94. int ax_drop();
  95. int sendframe();
  96. void axarp();
  97. struct mbuf *segmenter();
  98. void s_arcall(),s_atcall(),s_ascall();
  99. void st_ax25();
  100. int ax_recv();
  101. #endif
  102.  
  103. #endif    /* NULLAXADDR */
  104.